package com.yyw.foodie.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yyw.foodie.pojo.CategoryEntity;
import com.yyw.foodie.vo.CategoryTwoVo;
import com.yyw.foodie.vo.NewSixCategoryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 商品分类  Mapper 接口
 * </p>
 *
 * @author yiyw
 * @since 2021-05-22
 */
@Repository
public interface CategoryMapper extends BaseMapper<CategoryEntity> {

    /**
     * 根据父ID获取子分类数据
     * 二级分类ID获取三级分类数据
     * @param pid   父ID
     * @return
     */
    List<CategoryTwoVo> getCategoryByPid(@Param("pid") Integer pid);


    /**
     * 根据父ID （一级id）获取最新的6条商品信息
     * @param pid   一级分类ID
     * @return
     */
    List<NewSixCategoryVo> getNewSixItemsByPid(@Param("pid") Integer pid);

}
